package com.bawei.module_goods.network

import com.bawei.lib_net.entity.ResponseEntity
import com.bawei.module_goods.entity.AddCarParam
import com.bawei.module_goods.entity.DetailEntity
import com.bawei.module_goods.entity.CommentEntity
import com.bawei.module_goods.entity.GoodsBanner
import com.bawei.module_goods.entity.GroupType
import com.bawei.module_goods.entity.EventsType
import com.bawei.module_goods.entity.GoodsEntity
import com.bawei.module_goods.entity.ShoppingCartResponse

import com.bawei.module_goods.entity.UpdateCartItemRequest
import com.bawei.module_goods.model.FootPrintData
import com.bawei.module_goods.model.SearchGoodsItem
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Body
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST
import retrofit2.http.Query

interface GoodsApi {
    //首页轮播图
    @GET("/mall/mallHome/cmallBannerInfo")
    suspend fun getBannerList(): ResponseEntity<List<GoodsBanner>>
    //顶部tab
    @GET("/mall/mallHome/mallGroupIndexList")
    suspend fun getGroupList(): ResponseEntity<List<GroupType>>
    //活动内容
    @GET("/mall/mallHome/cmallConfList")
    suspend fun getEventList(): ResponseEntity<List<EventsType>>

    @GET("/mall/shoppingCart/orderShoppingCartList")
    suspend fun getShoppingCartList(): ResponseEntity<ShoppingCartResponse>

    //商品列表
    @GET("/mall/mallHome/cMallGroupList")
    suspend fun getGoodsList(): ResponseEntity<List<GoodsEntity>>

    @GET("/mall/goodsDetail/mallGoodsInfoInfo/{goodsId}")
    suspend fun getGoodsDetail(@Path("goodsId") goodsId: Int): ResponseEntity<DetailEntity>

    @POST("/mall/shoppingCart/delete")
    suspend fun deleteCartItem(@Body params: Map<String, String>): ResponseEntity<Boolean>

    @POST("/mall/goodsCollect/toggle/{goodsId}")
    suspend fun toggleCollect(@Path("goodsId") goodsId: Int): ResponseEntity<Boolean>

    @POST("/mall/shoppingCart/update")
    suspend fun updateCartItem(@Body params: UpdateCartItemRequest): ResponseEntity<Boolean>
    @GET("/mall/goodsFootPrint/view")
    suspend fun getFootPrint(): ResponseEntity<FootPrintData>
    //详情评论
    @GET("/mall/goodsComment/page/{goodsId}")
    suspend fun getDetailComment(@Path("goodsId")goodsId:Int,@Query("pageNum")pageNum: Int,@Query("pageSize")pageSize:Int): ResponseEntity<CommentEntity>

    @POST("/mall/goodsFootPrint/add/{goodsId}")
    suspend fun addFootPrint(@Path("goodsId") goodsId: Int): ResponseEntity<Boolean>

    @POST("/mall/shoppingCart/addShoppingCar")
    suspend fun addToCart(@Body params: AddCarParam): ResponseEntity<String>
    @FormUrlEncoded
    @POST("/mall/mallSearch/goodsSearchKeywordList")
    suspend fun searchGoods(@Field("keyword") keyword: String): ResponseEntity<List<SearchGoodsItem>>

}